package com.shang.common;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class CommonResult {

    private boolean success;

    private int code;

    private String msg;

    private Object data;

    public static CommonResult success(Object data){
        return new CommonResult(true,200,"success",data);
    }

    public static CommonResult fail(int code,String msg){
        return new CommonResult(false,code,msg,null);
    }

    public static CommonResult success(){
        return new CommonResult(true,200,"success",null);
    }

    public CommonResult(){

    }

    public CommonResult fail(String msg) {
        return new CommonResult(false,-1,msg,null);
    }
}
